package com.atguigu.gulimall.order.feign;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.order.vo.WareSkuLockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("gulimall-ware")    //标明要调用哪个远程服务
public interface WmsFeignService {
    /**
     * 为当前订单锁定库存
     */
    @PostMapping("/ware/waresku/lock/order")    //标明调用远程服务中的哪个功能
    R orderLockStock(@RequestBody WareSkuLockVo vo);

    /**
     * 根据地址 id 查询运费
     */
    @GetMapping("/ware/wareinfo/fare")
    R getFare(@RequestParam("addrId") Long addrId);

    /**
     * 根据 skuIds 批量查询商品是否有库存
     */
    @PostMapping("/ware/waresku/hasstock")    //标明调用远程服务中的哪个功能
    R getSkusHasStock(@RequestBody List<Long> skuIds);
}

